namespace Lion.Reports
{
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;
    using Telerik.Reporting;
    using Telerik.Reporting.Drawing;

    /// <summary>
    /// Summary description for GeneralLedger.
    /// </summary>
    public partial class GeneralLedger : Telerik.Reporting.Report
    {
        private GeneralLedger()
        {
            /// <summary>
            /// Required for telerik Reporting designer support
            /// </summary>
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
        public GeneralLedger(System.Data.DataTable dataTable,DateTime from,DateTime to)
            : this()
        {
            txtFrom.Value = from.ToString("MM / dd / yyyy");
            txtTo.Value = to.ToString("MM / dd / yyyy");

            dataTable.Columns.Add("Account", typeof(string));
            dataTable.Columns.Add("AccountCategory", typeof(string));
            foreach (System.Data.DataRow row in dataTable.Rows)
            {
                var account = Lion.Account.All[row["AccountID"].ToString()];
                row["Account"] = account.Name;
                row["AccountCategory"] = account.AccountCategory.Name;
            }
            this.DataSource = dataTable;
            
        }
    }
}